﻿using TI_BLE_HCI_ClientLib.BaseEntities;
using TI_BLE_HCI_ClientLib.GenericHCIEntities;
using TI_BLE_HCI_ClientLib.HCIBaseEntities;

namespace TI_BLE_HCI_ClientLib.HCICommands
{
    public class HCICommand_GAP_Establish_Link_Request : HCIVendorSpecificCommand
    {
        private const byte CMD = 0x9;

        public enum HighDutyCycleEnum
        {
            Disabled=0,
            Enabled=1
        }

        public enum WhiteListEnum
        {
            DontUseWhiteList = 0,
            OnlyConnectToDeviceInTheWhiteList = 1
        }

        public enum AddrTypePeerEnum
        {
            AddrType_Public=0,
            AddrType_Static = 1,
            AddrType_Private_NonResolve = 2,
            AddrType_Private_Resolve = 3
        }

        public enum Return_Status
        {
            Success = 0,
            NotReady_Performing_Scan = 0x10,
            InvalidProfileRole=0x12
        }

        public HCICommand_GAP_Establish_Link_Request(HighDutyCycleEnum highDutyCycle, WhiteListEnum whiteList, AddrTypePeerEnum addrTypePeer, byte[] peerAddr)
            : base(HCIVendorSpecificCommandCSG.GAP, CMD)
        {
            var pars = new BaseEntityParameter[4];

            pars[0] = new ByteParameter((byte)highDutyCycle);
            pars[1] = new ByteParameter((byte)whiteList);
            pars[2] = new ByteParameter((byte)addrTypePeer);
            pars[3] = new ByteArrayParameter(peerAddr);

            base.addParameters(pars);
        }
    }
}